import 'package:flutter/material.dart';
import 'package:flutter_picker/picker.dart';

showPicker(
  BuildContext context,
  List<dynamic> data,
  PickerConfirmCallback? confirm,
) {
  Picker(
      adapter: PickerDataAdapter<String>(pickerData: data,),
      cancelText: "取消",
      confirmText: "确定",
      height: 250,
      changeToFirst: true,
      textAlign: TextAlign.left,
      columnPadding: const EdgeInsets.all(8.0),
      onConfirm: confirm
  ).showBottomSheet(context);
}

showPickerWithDefaultPosition(
  BuildContext context,
  List<dynamic> data,
  int position,
  PickerConfirmCallback? confirm,
) {
  Picker(
      adapter: PickerDataAdapter<String>(pickerData: data,),
      cancelText: "取消",
      confirmText: "确定",
      height: 250,
      changeToFirst: true,
      textAlign: TextAlign.left,
      columnPadding: const EdgeInsets.all(8.0),
      selecteds: [position],
      onConfirm: confirm
  ).showBottomSheet(context);
}

showNumberPicker(
    BuildContext context,
    PickerAdapter adapter,
    PickerConfirmCallback callback,
) {
  Picker(
      adapter: adapter,
      cancelText: "取消",
      confirmText: "确定",
      height: 250,
      changeToFirst: true,
      textAlign: TextAlign.left,
      columnPadding: const EdgeInsets.all(8.0),
      onConfirm: callback
  ).showBottomSheet(context);
}
